//package com.naiterui.ehp.bs.recommend.dao.impl;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Set;
//
//import org.springframework.stereotype.Repository;
//
//import com.naiterui.common.repository.hibernate.DefaultBaseDaoImpl;
//import com.naiterui.ehp.bs.recommend.bean.DrStandardDiagnosis;
//import com.naiterui.ehp.bs.recommend.dao.IDrStandardDiagnosisDao;
//
//@Repository
//public class DrStandardDiagnosisDaoImpl extends DefaultBaseDaoImpl<DrStandardDiagnosis, Long> implements IDrStandardDiagnosisDao {
//
//    @Override
//    public List<DrStandardDiagnosis> findByIds(Set<Long> idSet) {
//        List<DrStandardDiagnosis> list = new ArrayList<>();
//        if (idSet == null || idSet.isEmpty()) {
//            return list;
//        }
//        StringBuilder sb = new StringBuilder();
//        for (Long id : idSet) {
//            sb.append(id).append(",");
//        }
//        if (sb.lastIndexOf(",") == sb.length() - 1) {
//            sb.deleteCharAt(sb.lastIndexOf(","));
//        }
//        if (sb.length() > 0) {
//            String hql = " from DrStandardDiagnosis where id in (" + sb.toString() + ")";
//            list = super.find(hql);
//        }
//        return list;
//    }
//
//    @Override
//    public long findIdByName(String name) {
//        String hql = " from DrStandardDiagnosis where name = ? ";
//        List<DrStandardDiagnosis> list = super.find(hql, name);
//        if (!list.isEmpty()) {
//            return list.get(0).getId();
//        }
//        return 0;
//    }
//
//    @Override
//    public List<DrStandardDiagnosis> findByNames(List<String> nameList) {
//        List<DrStandardDiagnosis> list = new ArrayList<>();
//        if (nameList == null || nameList.isEmpty()) {
//            return list;
//        }
//        StringBuilder sb = new StringBuilder();
//        for (int i = 0; i < nameList.size(); i++) {
//            sb.append("?").append(",");
//        }
//        if (sb.lastIndexOf(",") == sb.length() - 1) {
//            sb.deleteCharAt(sb.lastIndexOf(","));
//        }
//        if (sb.length() > 0) {
//            String hql = " from DrStandardDiagnosis where name in (" + sb.toString() + ")";
//            list = super.find(hql, nameList.toArray());
//        }
//        return list;
//    }
//
//}